﻿using System.Collections.Generic;
using System.ServiceModel;
using Metro.Kashikoi.Common.Entity;
using Metro.Kashikoi.Common.ExceptionHandling;
using Microsoft.Practices.EnterpriseLibrary.ExceptionHandling.WCF;
using Microsoft.Practices.EnterpriseLibrary.Validation.Integration.WCF;
using Microsoft.Practices.EnterpriseLibrary.Validation.Validators;

namespace Metro.Kashikoi.ServiceContract.Item
{
    /// <summary>
    /// This interface provides methods to manage the vendor.
    /// </summary>
    [ServiceContractAttribute]
    [ExceptionShielding]
    public interface IVendorService
    {
        /// <summary>
        /// Creates the vendor.
        /// </summary>
        /// <param name="vendor">The vendor.</param>
        /// <returns>The newly created vendor.</returns>
        [OperationContract]
        [ApplyDataContractResolver]
        [FaultContract(typeof(ServiceFault))]
        [FaultContract(typeof(ValidationFault))]
        Vendor CreateVendor(Vendor vendor);

        /// <summary>
        /// Updates the vendor.
        /// </summary>
        /// <param name="vendor">The vendor.</param>
        [OperationContract]
        [ApplyDataContractResolver]
        [FaultContract(typeof(ServiceFault))]
        [FaultContract(typeof(ValidationFault))]
        void UpdateVendor(Vendor vendor);

        /// <summary>
        /// Deletes the vendor.
        /// </summary>
        /// <param name="vendorId">The vendor id.</param>
        [OperationContract]
        [ApplyDataContractResolver]
        [FaultContract(typeof(ServiceFault))]
        [FaultContract(typeof(ValidationFault))]
        void DeleteVendor(
            [RangeValidator(0, RangeBoundaryType.Exclusive, int.MaxValue, RangeBoundaryType.Exclusive)]
            int vendorId);

        /// <summary>
        /// Gets all vendors.
        /// </summary>
        /// <returns>A list of vendor.</returns>
        [OperationContract]
        [ApplyDataContractResolver]
        [FaultContract(typeof(ServiceFault))]
        [FaultContract(typeof(ValidationFault))]
        IList<Vendor> GetAllVendors();
    }
}
